package com.example.commen.resource

import com.example.commen.BuildConfig
import com.example.commen.R
import com.example.commen.base.UCApplication
import com.example.commen.utile.CommonUtils

/**
 * Created by zyju on 2019/6/3.
 */
open class CommentContect {
    interface filePath {
        companion object {
            @JvmField
            val picture = CommonUtils.getFileDownRootPath() + "/picture/"
            @JvmField
            val publicFileDowns = CommonUtils.getPublicFileDownRootPath() + "/" + UCApplication.getContext().packageName + "/publicFileDowns/"
            @JvmField
            val publicYaSuoImgFiles = CommonUtils.getPrivateFileDownRootPath() + "/" + UCApplication.getContext().packageName + "/publicYaSuoImgFiles/"
            @JvmField
            val notificationMusic: String = "android.resource://" + UCApplication.getContext().packageName + "/" + R.raw.notification
        }
    }

    interface EmailConfig {
        companion object {
            const val isShowEmail = true

        }
    }

    interface EventBusCode{
        companion object {
            const val LoginError = 10000
            const val SearchMyTools = 11000
            const val emailCount = 12000
        }
    }
    interface intentKey {
        companion object {
            const val PreView = "PreView"
            const val WebUrl = "WebUrl"
            const val WebUrlType = "WebUrlType"
            const val Type = "Type"
            const val Data = "Data"
            const val Bundle = "bundle"
        }
    }

    interface config {
        companion object {
            /**
             * 默认每页加载数量
             */
            const val defaultPageSize = 10

            /**
             * dialog延迟结束时间
             */
            const val dialogDimesTime = 0
            /**
             * click点击间隔时间
             */
            const val clickDelayTime = 500L

            /**
             * 压缩中执行压缩条件.忽略大小
             * 单位:kb
             */
            const val ZoomIgnoreBy = 10240

        }
    }

    interface SpConstant {
        companion object {
            //引导界面标识位
            const val SP_ISTEST_URL = "SP_ISTEST_URL"
            const val LoginInfo = "loginInfo"
            const val LoginUserName = "loginUserName"
            const val LoginUserPswd = "LoginUserPswd"
            const val LoginRememberPswd = "LoginRememberPswd"
            const val UserInfo = "userinfo"
            const val MenuTree = "menutree"

            //[根据当前用户id获取角色 https://console-docs.apipost.cn/preview/98e14631c2fad07f/f762ba927d466e03?target_id=b5b912d1-96ed-4fc1-bd47-ee9c51e853f3]
            const val UserRole = "getUserRoleByUserIdAndSource"

            //[检查单最后一条新增数据]
            const val CheckList = "CheckList"
            //[飞行计划最后一条新增数据]
            const val FlyPlan = "FlyPlan"
            //[教员飞行计划最后一条新增数据]
            const val FlightPlan = "flightPlan"
            /**创建状态新信息单-故障原因和故障问题处理记录*/
            const val StatusErrorRecode = "StatusErrorRecode"
        }
    }

    interface regular {
        companion object {
            // 手机号
            const val phonePattern = "^1[3|5|6|7|8][0-9]{9}$"

            //邮箱
            const val emailPatternSimple = "^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$"
            const val emailPattern = "^\\w+((-\\w+)|(\\.\\w+))*@[A-Za-z0-9]+((\\.|-)[A-Za-z0-9]+)*\\.[A-Za-z0-9]+$"

            //身份证
            const val idCardPattern = "(^[1-9]\\d{5}(18|19|20|(3\\d))\\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$/) || (/^[1-9]\\d{5}\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{2}$)"

            //护照
            const val passPortPattern = "^((1[45]\\d{7})|(G\\d{8})|(P\\d{7})|(S\\d{7,8}))?$"

            //营业执照
            const val businessLicense = "(^(?:(?![IOZSV])[\\dA-Z]){2}\\d{6}(?:(?![IOZSV])[\\dA-Z]){10}$)|(^\\d{15}$)"

            //统一社会信用代码
            const val creditCode = "[^_IOZSVa-z\\W]{2}\\d{6}[^_IOZSVa-z\\W]{10}$"
        }
    }

    interface RequestCode {
        companion object {
            const val NETWORD_SUCCESS_STATUS = 200 //返回成功
            const val NETWORD_ERROR_STATUS = 1 //返回错误
            const val NETWORD_NEED_CPWD = 302 //需要修改密码
            const val NETWORD_FAIL = 400 //失败
            const val LoginOk = 1200
            const val LoginOut = 1201

            /**
             * 拍照
             */
            const val CHECK_PHONE = 11

            /**
             * 选择图片
             */
            const val CHECK_PICTURES = 1

            /**
             * 识别图片
             */
            const val YEY_PICTURES = 110
            const val YEY_PICTURES_CJ = 120

            /**
             * 图片识别返回
             */
            const val YEY_PICTURES_RESULT = 111
        }
    }

    companion object {

        var isLogin = false

        @JvmField
        var loginNameCache = ""

    }
}